import { CopyInfoPanelBase } from "../CopyInfoPanelBase";
import { Language } from "../../../../../extend/language/Language";
import { ObjCreate } from "../../common/ObjCreate";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { SecTimerView } from "../../common/SecTimerView";
import { FilterConst } from "../../../../component/gconst/FilterConst";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { SCrossStairInfo } from "../../../../../Message/Public/SCrossStairInfo";
import { CopyConfig } from "../../../resource/CopyConfig";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
type int = number;
//class CrossStairInfoPanel
    
    export  class CrossStairInfoPanel extends CopyInfoPanelBase
    {
        constructor()
        {
            super();
            title = Language.getString(60826);
            return;
        }

        protected /* override */ createChildren(): void
        {
            var loc1=null;
            super.createChildren();
            loc1 = ObjCreate.createGTextField(Language.getString(60834), _left + 20, 5, 240, 20, _bodySp, GlobalStyle.textFormat6);
            loc1.mouseEnabled = false;
            this._remainTime = new SecTimerView();
            this._remainTime.x = 120;
            this._remainTime.y = loc1.y;
            this._remainTime.width = 240;
            this._remainTime.height = 20;
            this._remainTime.filters = [FilterConst.glowFilter];
            this._remainTime.mouseEnabled = false;
            this._remainTime.setParse("hh: mm: ss");
            this._remainTime.defaultTextFormat = GlobalStyle.textFormatOrange;
            _bodySp.addChild(this._remainTime);
            loc1 = ObjCreate.createGTextField(Language.getString(60820), _left + 20, loc1.y + loc1.textHeight + 3, 240, 20, _bodySp, GlobalStyle.textFormat6);
            loc1.mouseEnabled = false;
            this._currentFloor = ObjCreate.createGTextField("0", 120, loc1.y, 240, 20, _bodySp, GlobalStyle.textFormat6);
            this._currentFloor.mouseEnabled = false;
            loc1 = ObjCreate.createGTextField(Language.getString(60821), _left + 20, loc1.y + loc1.textHeight + 3, 240, 20, _bodySp, GlobalStyle.textFormat6);
            loc1.mouseEnabled = false;
            this._topFloor = ObjCreate.createGTextField("0", 120, loc1.y, 240, 20, _bodySp, GlobalStyle.textFormat6);
            this._topFloor.mouseEnabled = false;
            loc1 = ObjCreate.createGTextField(Language.getString(60822), _left + 20, loc1.y + loc1.textHeight + 3, 240, 20, _bodySp, GlobalStyle.textFormat6);
            loc1.mouseEnabled = false;
            this._currentKill = ObjCreate.createGTextField("0", 120, loc1.y, 240, 20, _bodySp, GlobalStyle.textFormat6);
            this._currentKill.mouseEnabled = false;
            loc1 = ObjCreate.createGTextField(Language.getString(60823), _left + 20, loc1.y + loc1.textHeight + 3, 240, 20, _bodySp, GlobalStyle.textFormat6);
            loc1.mouseEnabled = false;
            this._totalKill = ObjCreate.createGTextField("0", 120, loc1.y, 240, 20, _bodySp, GlobalStyle.textFormat6);
            this._totalKill.mouseEnabled = false;
            loc1 = ObjCreate.createGTextField(Language.getString(60824), _left, loc1.y + loc1.textHeight + 10, 240, 20, _bodySp, new GTextFormat(null, 12, 11661311, null, null, null, null, null, null, null, null, null, 3));
            loc1.wordWrap = true;
            loc1.multiline = true;
            loc1.mouseEnabled = false;
            loc1.mouseWheelEnabled = false;
            loc1.autoSize = flash.text.TextFieldAutoSize.LEFT;
            loc1 = ObjCreate.createGTextField(Language.getString(60827), _left, loc1.y + loc1.textHeight + 10, 240, 20, _bodySp, new GTextFormat(FontUtil.songtiName, 14, 15788607));
            loc1.mouseEnabled = true;
            loc1.htmlText = HTMLUtil.addColor("<a href=\'event:\'><u>" + Language.getString(60827) + "</u></a>", "#FFFF00");
            loc1.autoSize = flash.text.TextFieldAutoSize.RIGHT;
            loc1.addEventListener(flash.events.TextEvent.LINK, this.onRankingLinkClick);
            _bg.height = _bodySp.height + 20;
            return;
        }

        /* internal  */onRankingLinkClick(arg1: Object /* flash.events.Event */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.CopyShowCrossStairRanking));
            return;
        }

        public updateData(arg1: SCrossStairInfo): void
        {
            if (!arg1) 
            {
                return;
            }
            var loc1=CopyConfig.instance.getCrossStairConfig(arg1.floor);
            if (loc1) 
            {
                if (loc1.killNum != 0) 
                {
                    this._currentKill.htmlText = HTMLUtil.addColor(HTMLUtil.addColor(arg1.killNum + "", "#FF0000") + " / " + loc1.killNum, "#B1efff");
                }
                else 
                {
                    this._currentKill.htmlText = HTMLUtil.addColor(arg1.killNum + "", "#FF0000");
                }
            }
            this._currentFloor.htmlText = HTMLUtil.addColor(arg1.floor + "", "#B1efff");
            this._topFloor.htmlText = HTMLUtil.addColor(arg1.maxFloor + "", "#FF00E4");
            this._totalKill.htmlText = HTMLUtil.addColor(arg1.totalKillNum + "", "#FF0000");
            return;
        }

        public updateTime(arg1: int): void
        {
            this._remainTime.setLeftTime(arg1);
            return;
        }

        public /* override */ hide(): void
        {
            super.hide();
            this._remainTime.dispose();
            return;
        }

        /* internal */ /* var */_remainTime: SecTimerView;

        /* internal */ /* var */_currentFloor: GTextFiled;

        /* internal */ /* var */_topFloor: GTextFiled;

        /* internal */ /* var */_currentKill: GTextFiled;

        /* internal */ /* var */_totalKill: GTextFiled;
    }
